package com.young.shop.controller;

import com.young.shop.utils.email;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@WebServlet("/sendEmail")
public class SendEmailController extends BaseController {
    public static Map codeMap=new HashMap<String,String>();
    @Override
    protected void doGet(HttpServletRequest req , HttpServletResponse resp) throws ServletException, IOException {
//        String email1 = req.getReader().readLine();
        String emailParam = req.getParameter("email");
        System.out.println("获取前端"+emailParam);
        String code = email.SendToEmail(emailParam);
        System.out.println("code:"+code);
        codeMap.put(emailParam,code);
//        req.getSession().setAttribute("code",code);
    }
}
